/*      */ package com.zimbra.cs.ldap.unboundid;
/*      */ 
/*      */ import com.google.common.collect.Lists;
/*      */ import com.unboundid.ldap.sdk.Filter;
/*      */ import com.unboundid.ldap.sdk.LDAPException;
/*      */ import com.zimbra.common.account.ZAttrProvisioning.DomainType;
/*      */ import com.zimbra.common.util.Log;
/*      */ import com.zimbra.common.util.ZimbraLog;
/*      */ import com.zimbra.cs.account.AttributeClass;
/*      */ import com.zimbra.cs.ldap.LdapException;
/*      */ import com.zimbra.cs.ldap.ZLdapFilter;
/*      */ import com.zimbra.cs.ldap.ZLdapFilterFactory;
/*      */ import com.zimbra.cs.ldap.ZLdapFilterFactory.FilterId;
/*      */ import java.util.Collection;
/*      */ import java.util.List;
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ public class UBIDLdapFilterFactory
/*      */   extends ZLdapFilterFactory
/*      */ {
/*      */   private static Filter FILTER_ALL_ACCOUNTS;
/*      */   private static Filter FILTER_ALL_ACCOUNTS_ONLY;
/*      */   private static Filter FILTER_ALL_ADMIN_ACCOUNTS;
/*      */   private static Filter FILTER_ALL_ALIASES;
/*      */   private static Filter FILTER_ALL_CALENDAR_RESOURCES;
/*      */   private static Filter FILTER_ALL_COSES;
/*      */   private static Filter FILTER_ALL_DATASOURCES;
/*      */   private static Filter FILTER_ALL_DISTRIBUTION_LISTS;
/*      */   private static Filter FILTER_ALL_DOMAINS;
/*      */   private static Filter FILTER_ALL_DYNAMIC_GROUPS;
/*      */   private static Filter FILTER_ALL_DYNAMIC_GROUP_DYNAMIC_UNITS;
/*      */   private static Filter FILTER_ALL_DYNAMIC_GROUP_STATIC_UNITS;
/*      */   private static Filter FILTER_ALL_GROUPS;
/*      */   private static Filter FILTER_ALL_IDENTITIES;
/*      */   private static Filter FILTER_ALL_MIME_ENTRIES;
/*      */   private static Filter FILTER_ALL_NON_SYSTEM_ACCOUNTS;
/*      */   private static Filter FILTER_ALL_NON_SYSTEM_ARCHIVING_ACCOUNTS;
/*      */   private static Filter FILTER_ALL_NON_SYSTEM_INTERNAL_ACCOUNTS;
/*      */   private static Filter FILTER_ALL_SERVERS;
/*      */   private static Filter FILTER_ALL_ALWAYSONCLUSTERS;
/*      */   private static Filter FILTER_ALL_UC_SERVICES;
/*      */   private static Filter FILTER_ALL_SHARE_LOCATORS;
/*      */   private static Filter FILTER_ALL_SIGNATURES;
/*      */   private static Filter FILTER_ALL_XMPP_COMPONENTS;
/*      */   private static Filter FILTER_ALL_ZIMLETS;
/*      */   private static Filter FILTER_ANY_ENTRY;
/*      */   private static Filter FILTER_DOMAIN_LABEL;
/*      */   private static Filter FILTER_HAS_SUBORDINATES;
/*      */   private static Filter FILTER_IS_ARCHIVING_ACCOUNT;
/*      */   private static Filter FILTER_IS_EXTERNAL_ACCOUNT;
/*      */   private static Filter FILTER_IS_SYSTEM_RESOURCE;
/*      */   private static Filter FILTER_NOT_SYSTEM_RESOURCE;
/*      */   private static Filter FILTER_PUBLIC_SHARE;
/*      */   private static Filter FILTER_ALLAUTHED_SHARE;
/*      */   private static Filter FILTER_NOT_EXCLUDED_FROM_CMB_SEARCH;
/*      */   private static Filter FILTER_WITH_ARCHIVE;
/*      */   private static Filter FILTER_ALL_INTERNAL_ACCOUNTS;
/*      */   
/*      */   public void debug() {}
/*      */   
/*   85 */   private static boolean initialized = false;
/*      */   
/*      */   public static synchronized void initialize() throws LdapException {
/*   88 */     assert (!initialized);
/*   89 */     initialized = true;
/*      */     try
/*      */     {
/*   92 */       _initialize();
/*      */     } catch (LDAPException e) {
/*   94 */       throw UBIDLdapException.mapToLdapException(e);
/*      */     }
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   private static void _initialize()
/*      */     throws LDAPException
/*      */   {
/*  108 */     FILTER_ALL_ACCOUNTS = Filter.createEqualityFilter("objectClass", AttributeClass.OC_zimbraAccount);
/*      */     
/*      */ 
/*  111 */     FILTER_ALL_ALIASES = Filter.createEqualityFilter("objectClass", AttributeClass.OC_zimbraAlias);
/*      */     
/*      */ 
/*  114 */     FILTER_ALL_CALENDAR_RESOURCES = Filter.createEqualityFilter("objectClass", AttributeClass.OC_zimbraCalendarResource);
/*      */     
/*      */ 
/*      */ 
/*  118 */     FILTER_ALL_COSES = Filter.createEqualityFilter("objectClass", AttributeClass.OC_zimbraCOS);
/*      */     
/*      */ 
/*      */ 
/*  122 */     FILTER_ALL_DATASOURCES = Filter.createEqualityFilter("objectClass", AttributeClass.OC_zimbraDataSource);
/*      */     
/*      */ 
/*      */ 
/*  126 */     FILTER_ALL_DISTRIBUTION_LISTS = Filter.createEqualityFilter("objectClass", AttributeClass.OC_zimbraDistributionList);
/*      */     
/*      */ 
/*      */ 
/*  130 */     FILTER_ALL_DOMAINS = Filter.createEqualityFilter("objectClass", AttributeClass.OC_zimbraDomain);
/*      */     
/*      */ 
/*      */ 
/*  134 */     FILTER_ALL_DYNAMIC_GROUPS = Filter.createEqualityFilter("objectClass", AttributeClass.OC_zimbraGroup);
/*      */     
/*      */ 
/*      */ 
/*  138 */     FILTER_ALL_DYNAMIC_GROUP_DYNAMIC_UNITS = Filter.createEqualityFilter("objectClass", AttributeClass.OC_zimbraGroupDynamicUnit);
/*      */     
/*      */ 
/*      */ 
/*  142 */     FILTER_ALL_DYNAMIC_GROUP_STATIC_UNITS = Filter.createEqualityFilter("objectClass", AttributeClass.OC_zimbraGroupStaticUnit);
/*      */     
/*      */ 
/*      */ 
/*  146 */     FILTER_ALL_IDENTITIES = Filter.createEqualityFilter("objectClass", AttributeClass.OC_zimbraIdentity);
/*      */     
/*      */ 
/*      */ 
/*  150 */     FILTER_ALL_MIME_ENTRIES = Filter.createEqualityFilter("objectClass", AttributeClass.OC_zimbraMimeEntry);
/*      */     
/*      */ 
/*      */ 
/*  154 */     FILTER_ALL_SERVERS = Filter.createEqualityFilter("objectClass", AttributeClass.OC_zimbraServer);
/*      */     
/*      */ 
/*      */ 
/*  158 */     FILTER_ALL_ALWAYSONCLUSTERS = Filter.createEqualityFilter("objectClass", AttributeClass.OC_zimbraAlwaysOnCluster);
/*      */     
/*      */ 
/*      */ 
/*  162 */     FILTER_ALL_UC_SERVICES = Filter.createEqualityFilter("objectClass", AttributeClass.OC_zimbraUCService);
/*      */     
/*      */ 
/*      */ 
/*  166 */     FILTER_ALL_SHARE_LOCATORS = Filter.createEqualityFilter("objectClass", AttributeClass.OC_zimbraShareLocator);
/*      */     
/*      */ 
/*      */ 
/*  170 */     FILTER_ALL_SIGNATURES = Filter.createEqualityFilter("objectClass", AttributeClass.OC_zimbraSignature);
/*      */     
/*      */ 
/*      */ 
/*  174 */     FILTER_ALL_XMPP_COMPONENTS = Filter.createEqualityFilter("objectClass", AttributeClass.OC_zimbraXMPPComponent);
/*      */     
/*      */ 
/*      */ 
/*  178 */     FILTER_ALL_ZIMLETS = Filter.createEqualityFilter("objectClass", AttributeClass.OC_zimbraZimletEntry);
/*      */     
/*      */ 
/*      */ 
/*  182 */     FILTER_ANY_ENTRY = Filter.createPresenceFilter("objectClass");
/*      */     
/*      */ 
/*  185 */     FILTER_DOMAIN_LABEL = Filter.createEqualityFilter("objectClass", "dcObject");
/*      */     
/*      */ 
/*      */ 
/*  189 */     FILTER_HAS_SUBORDINATES = Filter.createEqualityFilter("hasSubordinates", "TRUE");
/*      */     
/*      */ 
/*      */ 
/*  193 */     FILTER_IS_ARCHIVING_ACCOUNT = Filter.createPresenceFilter("amavisArchiveQuarantineTo");
/*      */     
/*      */ 
/*  196 */     FILTER_IS_EXTERNAL_ACCOUNT = Filter.createEqualityFilter("zimbraIsExternalVirtualAccount", "TRUE");
/*      */     
/*      */ 
/*      */ 
/*  200 */     FILTER_IS_SYSTEM_RESOURCE = Filter.createEqualityFilter("zimbraIsSystemResource", "TRUE");
/*      */     
/*      */ 
/*      */ 
/*  204 */     FILTER_NOT_SYSTEM_RESOURCE = Filter.createNOTFilter(FILTER_IS_SYSTEM_RESOURCE);
/*      */     
/*      */ 
/*  207 */     FILTER_PUBLIC_SHARE = Filter.createSubstringFilter("zimbraSharedItem", null, new String[] { "granteeType:pub" }, null);
/*      */     
/*      */ 
/*      */ 
/*  211 */     FILTER_ALLAUTHED_SHARE = Filter.createSubstringFilter("zimbraSharedItem", null, new String[] { "granteeType:all" }, null);
/*      */     
/*      */ 
/*      */ 
/*  215 */     FILTER_NOT_EXCLUDED_FROM_CMB_SEARCH = Filter.createORFilter(new Filter[] { Filter.createNOTFilter(Filter.createPresenceFilter("zimbraExcludeFromCMBSearch")), Filter.createEqualityFilter("zimbraExcludeFromCMBSearch", "FALSE") });
/*      */     
/*      */ 
/*      */ 
/*      */ 
/*  220 */     FILTER_WITH_ARCHIVE = Filter.createPresenceFilter("zimbraArchiveAccount");
/*      */     
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*  227 */     FILTER_ALL_ACCOUNTS_ONLY = Filter.createANDFilter(new Filter[] { FILTER_ALL_ACCOUNTS, Filter.createNOTFilter(FILTER_ALL_CALENDAR_RESOURCES) });
/*      */     
/*      */ 
/*      */ 
/*      */ 
/*  232 */     FILTER_ALL_ADMIN_ACCOUNTS = Filter.createANDFilter(new Filter[] { FILTER_ALL_ACCOUNTS, Filter.createORFilter(new Filter[] { Filter.createEqualityFilter("zimbraIsAdminAccount", "TRUE"), Filter.createEqualityFilter("zimbraIsDelegatedAdminAccount", "TRUE"), Filter.createEqualityFilter("zimbraIsDomainAdminAccount", "TRUE") }) });
/*      */     
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*  240 */     FILTER_ALL_NON_SYSTEM_ACCOUNTS = Filter.createANDFilter(new Filter[] { FILTER_ALL_ACCOUNTS_ONLY, Filter.createNOTFilter(FILTER_IS_SYSTEM_RESOURCE) });
/*      */     
/*      */ 
/*      */ 
/*      */ 
/*  245 */     FILTER_ALL_NON_SYSTEM_ARCHIVING_ACCOUNTS = Filter.createANDFilter(new Filter[] { FILTER_ALL_ACCOUNTS_ONLY, Filter.createNOTFilter(FILTER_IS_SYSTEM_RESOURCE), FILTER_IS_ARCHIVING_ACCOUNT });
/*      */     
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*  251 */     FILTER_ALL_NON_SYSTEM_INTERNAL_ACCOUNTS = Filter.createANDFilter(new Filter[] { FILTER_ALL_ACCOUNTS, Filter.createNOTFilter(FILTER_IS_SYSTEM_RESOURCE), Filter.createNOTFilter(FILTER_ALL_CALENDAR_RESOURCES), Filter.createNOTFilter(FILTER_IS_EXTERNAL_ACCOUNT) });
/*      */     
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*  258 */     FILTER_ALL_GROUPS = Filter.createORFilter(new Filter[] { FILTER_ALL_DYNAMIC_GROUPS, FILTER_ALL_DISTRIBUTION_LISTS });
/*      */     
/*      */ 
/*      */ 
/*      */ 
/*  263 */     FILTER_ALL_INTERNAL_ACCOUNTS = Filter.createANDFilter(new Filter[] { FILTER_ALL_ACCOUNTS, Filter.createNOTFilter(FILTER_IS_EXTERNAL_ACCOUNT) });
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */   public String encodeValue(String value)
/*      */   {
/*  270 */     return Filter.encodeValue(value);
/*      */   }
/*      */   
/*      */   private Filter homedOnServerFilter(String serverServiceHostname) {
/*  274 */     return Filter.createEqualityFilter("zimbraMailHost", serverServiceHostname);
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter hasSubordinates()
/*      */   {
/*  282 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.HAS_SUBORDINATES, FILTER_HAS_SUBORDINATES);
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */   public ZLdapFilter createdLaterOrEqual(String generalizedTime)
/*      */   {
/*  289 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.CREATED_LATEROREQUAL, Filter.createGreaterOrEqualFilter("createTimestamp", generalizedTime));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter anyEntry()
/*      */   {
/*  299 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.ANY_ENTRY, FILTER_ANY_ENTRY);
/*      */   }
/*      */   
/*      */ 
/*      */   public ZLdapFilter fromFilterString(ZLdapFilterFactory.FilterId filterId, String filterString)
/*      */     throws LdapException
/*      */   {
/*      */     try
/*      */     {
/*  308 */       return new UBIDLdapFilter(filterId, Filter.create(encloseFilterIfNot(filterString)));
/*      */     }
/*      */     catch (LDAPException e)
/*      */     {
/*  312 */       throw UBIDLdapException.mapToLdapException(filterString, e);
/*      */     }
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter andWith(ZLdapFilter filter, ZLdapFilter otherFilter)
/*      */   {
/*  325 */     ZLdapFilter andedFilter = null;
/*      */     try {
/*  327 */       andedFilter = new UBIDLdapFilter(filter.getFilterId(), Filter.createANDFilter(new Filter[] { ((UBIDLdapFilter)filter).getNative(), ((UBIDLdapFilter)fromFilterString(ZLdapFilterFactory.FilterId.DN_SUBTREE_MATCH, otherFilter.toFilterString())).getNative() }));
/*      */ 
/*      */     }
/*      */     catch (LdapException e)
/*      */     {
/*      */ 
/*  333 */       ZimbraLog.ldap.warn("filter error", e);
/*  334 */       if (!$assertionsDisabled) throw new AssertionError();
/*      */     }
/*  336 */     return andedFilter;
/*      */   }
/*      */   
/*      */   public ZLdapFilter negate(ZLdapFilter filter)
/*      */   {
/*  341 */     return new UBIDLdapFilter(filter.getFilterId(), Filter.createNOTFilter(((UBIDLdapFilter)filter).getNative()));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter addrsExist(String[] addrs)
/*      */   {
/*  354 */     List<Filter> filters = Lists.newArrayList();
/*  355 */     for (int i = 0; i < addrs.length; i++) {
/*  356 */       filters.add(Filter.createEqualityFilter("zimbraMailDeliveryAddress", addrs[i]));
/*  357 */       filters.add(Filter.createEqualityFilter("zimbraMailAlias", addrs[i]));
/*      */     }
/*      */     
/*  360 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.ADDRS_EXIST, Filter.createORFilter(filters));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter allAccounts()
/*      */   {
/*  371 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.ALL_ACCOUNTS, FILTER_ALL_ACCOUNTS);
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */   public ZLdapFilter allAccountsOnly()
/*      */   {
/*  378 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.ALL_ACCOUNTS_ONLY, FILTER_ALL_ACCOUNTS_ONLY);
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */   public ZLdapFilter allAdminAccounts()
/*      */   {
/*  385 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.ALL_ADMIN_ACCOUNTS, FILTER_ALL_ADMIN_ACCOUNTS);
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */   public ZLdapFilter allNonSystemAccounts()
/*      */   {
/*  392 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.ALL_NON_SYSTEM_ACCOUNTS, FILTER_ALL_NON_SYSTEM_ACCOUNTS);
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */   public ZLdapFilter allNonSystemArchivingAccounts()
/*      */   {
/*  399 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.ALL_NON_SYSTEM_ARCHIVING_ACCOUNTS, FILTER_ALL_NON_SYSTEM_ARCHIVING_ACCOUNTS);
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */   public ZLdapFilter allNonSystemInternalAccounts()
/*      */   {
/*  406 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.ALL_NON_SYSTEM_INTERNAL_ACCOUNTS, FILTER_ALL_NON_SYSTEM_INTERNAL_ACCOUNTS);
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */   public ZLdapFilter accountByForeignPrincipal(String foreignPrincipal)
/*      */   {
/*  413 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.ACCOUNT_BY_FOREIGN_PRINCIPAL, Filter.createANDFilter(new Filter[] { Filter.createEqualityFilter("zimbraForeignPrincipal", foreignPrincipal), FILTER_ALL_ACCOUNTS }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter accountById(String id)
/*      */   {
/*  422 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.ACCOUNT_BY_ID, Filter.createANDFilter(new Filter[] { Filter.createEqualityFilter("zimbraId", id), FILTER_ALL_ACCOUNTS }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter accountByMemberOf(String dynGroupId)
/*      */   {
/*  431 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.ACCOUNT_BY_MEMBEROF, Filter.createANDFilter(new Filter[] { Filter.createEqualityFilter("zimbraMemberOf", dynGroupId), FILTER_ALL_INTERNAL_ACCOUNTS }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter accountByName(String name)
/*      */   {
/*  440 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.ACCOUNT_BY_NAME, Filter.createANDFilter(new Filter[] { Filter.createORFilter(new Filter[] { Filter.createEqualityFilter("zimbraMailDeliveryAddress", name), Filter.createEqualityFilter("zimbraMailAlias", name) }), FILTER_ALL_ACCOUNTS }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter adminAccountByRDN(String namingRdnAttr, String name)
/*      */   {
/*  451 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.ADMIN_ACCOUNT_BY_RDN, Filter.createANDFilter(new Filter[] { Filter.createEqualityFilter(namingRdnAttr, name), FILTER_ALL_ACCOUNTS }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter accountsHomedOnServer(String serverServiceHostname)
/*      */   {
/*  460 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.ACCOUNTS_HOMED_ON_SERVER, Filter.createANDFilter(new Filter[] { FILTER_ALL_ACCOUNTS, homedOnServerFilter(serverServiceHostname) }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter accountsHomedOnServerAccountsOnly(String serverServiceHostname)
/*      */   {
/*  469 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.ACCOUNTS_HOMED_ON_SERVER_ACCOUNTS_ONLY, Filter.createANDFilter(new Filter[] { FILTER_ALL_ACCOUNTS_ONLY, homedOnServerFilter(serverServiceHostname) }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter homedOnServer(String serverServiceHostname)
/*      */   {
/*  478 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.HOMED_ON_SERVER, homedOnServerFilter(serverServiceHostname));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */   public ZLdapFilter accountsOnServerAndCosHasSubordinates(String serverServiceHostname, String cosId)
/*      */   {
/*  485 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.ACCOUNTS_ON_SERVER_AND_COS_HAS_SUBORDINATES, Filter.createANDFilter(new Filter[] { FILTER_ALL_ACCOUNTS, homedOnServerFilter(serverServiceHostname), FILTER_HAS_SUBORDINATES, Filter.createORFilter(new Filter[] { Filter.createNOTFilter(Filter.createPresenceFilter("zimbraCOSId")), Filter.createEqualityFilter("zimbraCOSId", cosId) }) }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter accountsOnUCService(String usServiceId)
/*      */   {
/*  498 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.ACCOUNTS_ON_UCSERVICE, Filter.createANDFilter(new Filter[] { Filter.createEqualityFilter("zimbraUCServiceId", usServiceId), FILTER_ALL_ACCOUNTS }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter externalAccountsHomedOnServer(String serverServiceHostname)
/*      */   {
/*  507 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.EXTERNAL_ACCOUNTS_HOMED_ON_SERVER, Filter.createANDFilter(new Filter[] { FILTER_ALL_ACCOUNTS_ONLY, FILTER_IS_EXTERNAL_ACCOUNT, homedOnServerFilter(serverServiceHostname) }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter accountsByGrants(List<String> granteeIds, boolean includePublicShares, boolean includeAllAuthedShares)
/*      */   {
/*  519 */     List<Filter> filters = Lists.newArrayList();
/*  520 */     for (String granteeId : granteeIds) {
/*  521 */       filters.add(Filter.createSubstringFilter("zimbraSharedItem", "granteeId:" + granteeId, null, null));
/*      */     }
/*      */     
/*  524 */     if (includePublicShares) {
/*  525 */       filters.add(FILTER_PUBLIC_SHARE);
/*      */     }
/*      */     
/*  528 */     if (includeAllAuthedShares) {
/*  529 */       filters.add(FILTER_ALLAUTHED_SHARE);
/*      */     }
/*      */     
/*  532 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.ACCOUNTS_BY_GRANTS, Filter.createANDFilter(new Filter[] { FILTER_ALL_ACCOUNTS, Filter.createORFilter(filters) }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter CMBSearchAccountsOnly()
/*      */   {
/*  541 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.CMB_SEARCH_ACCOUNTS_ONLY, Filter.createANDFilter(new Filter[] { FILTER_ALL_ACCOUNTS_ONLY, FILTER_NOT_EXCLUDED_FROM_CMB_SEARCH }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter CMBSearchAccountsOnlyWithArchive()
/*      */   {
/*  550 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.CMB_SEARCH_ACCOUNTS_ONLY_WITH_ARCHIVE, Filter.createANDFilter(new Filter[] { FILTER_ALL_ACCOUNTS_ONLY, FILTER_WITH_ARCHIVE, FILTER_NOT_EXCLUDED_FROM_CMB_SEARCH }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter CMBSearchNonSystemResourceAccountsOnly()
/*      */   {
/*  560 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.CMB_SEARCH_NON_SYSTEM_RESOURCE_ACCOUNTS_ONLY, Filter.createANDFilter(new Filter[] { FILTER_ALL_ACCOUNTS_ONLY, FILTER_NOT_SYSTEM_RESOURCE, FILTER_NOT_EXCLUDED_FROM_CMB_SEARCH }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter allAliases()
/*      */   {
/*  574 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.ALL_ALIASES, FILTER_ALL_ALIASES);
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter allCalendarResources()
/*      */   {
/*  584 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.ALL_CALENDAR_RESOURCES, FILTER_ALL_CALENDAR_RESOURCES);
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */   public ZLdapFilter calendarResourceByForeignPrincipal(String foreignPrincipal)
/*      */   {
/*  591 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.CALENDAR_RESOURCE_BY_FOREIGN_PRINCIPAL, Filter.createANDFilter(new Filter[] { Filter.createEqualityFilter("zimbraForeignPrincipal", foreignPrincipal), FILTER_ALL_CALENDAR_RESOURCES }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter calendarResourceById(String id)
/*      */   {
/*  600 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.CALENDAR_RESOURCE_BY_ID, Filter.createANDFilter(new Filter[] { Filter.createEqualityFilter("zimbraId", id), FILTER_ALL_CALENDAR_RESOURCES }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter calendarResourceByName(String name)
/*      */   {
/*  609 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.CALENDAR_RESOURCE_BY_NAME, Filter.createANDFilter(new Filter[] { Filter.createORFilter(new Filter[] { Filter.createEqualityFilter("zimbraMailDeliveryAddress", name), Filter.createEqualityFilter("zimbraMailAlias", name) }), FILTER_ALL_CALENDAR_RESOURCES }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter calendarResourcesHomedOnServer(String serverServiceHostname)
/*      */   {
/*  620 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.CALENDAR_RESOURCES_HOMED_ON_SERVER, Filter.createANDFilter(new Filter[] { FILTER_ALL_CALENDAR_RESOURCES, homedOnServerFilter(serverServiceHostname) }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter allCoses()
/*      */   {
/*  633 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.ALL_COSES, FILTER_ALL_COSES);
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */   public ZLdapFilter cosById(String id)
/*      */   {
/*  640 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.COS_BY_ID, Filter.createANDFilter(new Filter[] { Filter.createEqualityFilter("zimbraId", id), FILTER_ALL_COSES }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter cosesByMailHostPool(String serverId)
/*      */   {
/*  649 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.COSES_BY_MAILHOST_POOL, Filter.createANDFilter(new Filter[] { FILTER_ALL_COSES, Filter.createEqualityFilter("zimbraMailHostPool", serverId) }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter cosesOnUCService(String usServiceId)
/*      */   {
/*  658 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.COSES_ON_UCSERVICE, Filter.createANDFilter(new Filter[] { Filter.createEqualityFilter("zimbraUCServiceId", usServiceId), FILTER_ALL_COSES }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter allDataSources()
/*      */   {
/*  671 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.ALL_DATA_SOURCES, FILTER_ALL_DATASOURCES);
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */   public ZLdapFilter dataSourceById(String id)
/*      */   {
/*  678 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.DATA_SOURCE_BY_ID, Filter.createANDFilter(new Filter[] { FILTER_ALL_DATASOURCES, Filter.createEqualityFilter("zimbraDataSourceId", id) }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter dataSourceByName(String name)
/*      */   {
/*  687 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.DATA_SOURCE_BY_NAME, Filter.createANDFilter(new Filter[] { FILTER_ALL_DATASOURCES, Filter.createEqualityFilter("zimbraDataSourceName", name) }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter allDistributionLists()
/*      */   {
/*  700 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.ALL_DISTRIBUTION_LISTS, FILTER_ALL_DISTRIBUTION_LISTS);
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */   public ZLdapFilter distributionListById(String id)
/*      */   {
/*  707 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.DISTRIBUTION_LIST_BY_ID, Filter.createANDFilter(new Filter[] { Filter.createEqualityFilter("zimbraId", id), FILTER_ALL_DISTRIBUTION_LISTS }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter distributionListByName(String name)
/*      */   {
/*  716 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.DISTRIBUTION_LIST_BY_NAME, Filter.createANDFilter(new Filter[] { Filter.createEqualityFilter("zimbraMailAlias", name), FILTER_ALL_DISTRIBUTION_LISTS }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter distributionListsByMemberAddrs(String[] memberAddrs)
/*      */   {
/*  725 */     List<Filter> filters = Lists.newArrayList();
/*  726 */     for (int i = 0; i < memberAddrs.length; i++) {
/*  727 */       filters.add(Filter.createEqualityFilter("zimbraMailForwardingAddress", memberAddrs[i]));
/*      */     }
/*      */     
/*  730 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.DISTRIBUTION_LISTS_BY_MEMBER_ADDRS, Filter.createANDFilter(new Filter[] { FILTER_ALL_DISTRIBUTION_LISTS, Filter.createORFilter(filters) }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter allDynamicGroups()
/*      */   {
/*  742 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.ALL_DYNAMIC_GROUPS, FILTER_ALL_DYNAMIC_GROUPS);
/*      */   }
/*      */   
/*      */   public ZLdapFilter dynamicGroupById(String id)
/*      */   {
/*  747 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.DYNAMIC_GROUP_BY_ID, Filter.createANDFilter(new Filter[] { Filter.createEqualityFilter("zimbraId", id), FILTER_ALL_DYNAMIC_GROUPS }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter dynamicGroupByIds(String[] ids)
/*      */   {
/*  756 */     List<Filter> filters = Lists.newArrayList();
/*  757 */     for (String id : ids) {
/*  758 */       filters.add(Filter.createEqualityFilter("zimbraId", id));
/*      */     }
/*  760 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.DYNAMIC_GROUP_BY_IDS, Filter.createANDFilter(new Filter[] { FILTER_ALL_DYNAMIC_GROUPS, Filter.createORFilter(new Filter[] { Filter.createORFilter(filters) }) }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */   public ZLdapFilter dynamicGroupByName(String name)
/*      */   {
/*  767 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.DYNAMIC_GROUP_BY_NAME, Filter.createANDFilter(new Filter[] { Filter.createEqualityFilter("zimbraMailAlias", name), FILTER_ALL_DYNAMIC_GROUPS }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter dynamicGroupDynamicUnitByMailAddr(String mailAddr)
/*      */   {
/*  776 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.DYNAMIC_GROUP_DYNAMIC_UNIT_BY_MAIL_ADDR, Filter.createANDFilter(new Filter[] { FILTER_ALL_DYNAMIC_GROUP_DYNAMIC_UNITS, Filter.createEqualityFilter("mail", mailAddr) }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter dynamicGroupsStaticUnitByMemberAddr(String memberAddr)
/*      */   {
/*  785 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.DYNAMIC_GROUPS_STATIC_UNIT_BY_MEMBER_ADDR, Filter.createANDFilter(new Filter[] { FILTER_ALL_DYNAMIC_GROUP_STATIC_UNITS, Filter.createEqualityFilter("zimbraMailForwardingAddress", memberAddr) }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter allGroups()
/*      */   {
/*  797 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.ALL_GROUPS, FILTER_ALL_GROUPS);
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */   public ZLdapFilter groupById(String id)
/*      */   {
/*  804 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.GROUP_BY_ID, Filter.createANDFilter(new Filter[] { Filter.createEqualityFilter("zimbraId", id), FILTER_ALL_GROUPS }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter groupByName(String name)
/*      */   {
/*  813 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.GROUP_BY_NAME, Filter.createANDFilter(new Filter[] { Filter.createEqualityFilter("zimbraMailAlias", name), FILTER_ALL_GROUPS }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter allDomains()
/*      */   {
/*  826 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.ALL_DOMAINS, FILTER_ALL_DOMAINS);
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */   public ZLdapFilter domainAliases(String id)
/*      */   {
/*  833 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.DOMAIN_ALIASES, Filter.createANDFilter(new Filter[] { Filter.createEqualityFilter("zimbraDomainAliasTargetId", id), FILTER_ALL_DOMAINS, Filter.createEqualityFilter("zimbraDomainType", ZAttrProvisioning.DomainType.alias.name()) }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter domainById(String id)
/*      */   {
/*  843 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.DOMAIN_BY_ID, Filter.createANDFilter(new Filter[] { Filter.createEqualityFilter("zimbraId", id), FILTER_ALL_DOMAINS }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter domainsByIds(Collection<String> ids)
/*      */   {
/*  852 */     List<Filter> filters = Lists.newArrayList();
/*  853 */     for (String id : ids) {
/*  854 */       filters.add(Filter.createEqualityFilter("zimbraId", id));
/*      */     }
/*  856 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.DOMAINS_BY_IDS, Filter.createANDFilter(new Filter[] { FILTER_ALL_DOMAINS, Filter.createORFilter(new Filter[] { Filter.createORFilter(filters) }) }));
/*      */   }
/*      */   
/*      */ 
/*      */   public ZLdapFilter domainByName(String name)
/*      */   {
/*  862 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.DOMAIN_BY_NAME, Filter.createANDFilter(new Filter[] { Filter.createEqualityFilter("zimbraDomainName", name), FILTER_ALL_DOMAINS }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter domainByKrb5Realm(String krb5Realm)
/*      */   {
/*  871 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.DOMAIN_BY_KRB5_REALM, Filter.createANDFilter(new Filter[] { Filter.createEqualityFilter("zimbraAuthKerberos5Realm", krb5Realm), FILTER_ALL_DOMAINS }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter domainByVirtualHostame(String virtualHostname)
/*      */   {
/*  880 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.DOMAIN_BY_VIRTUAL_HOSTNAME, Filter.createANDFilter(new Filter[] { Filter.createEqualityFilter("zimbraVirtualHostname", virtualHostname), FILTER_ALL_DOMAINS }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter domainByForeignName(String foreignName)
/*      */   {
/*  889 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.DOMAIN_BY_FOREIGN_NAME, Filter.createANDFilter(new Filter[] { Filter.createEqualityFilter("zimbraForeignName", foreignName), FILTER_ALL_DOMAINS }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter domainLabel()
/*      */   {
/*  898 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.DOMAIN_LABEL, FILTER_DOMAIN_LABEL);
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */   public ZLdapFilter domainLockedForEagerAutoProvision()
/*      */   {
/*  905 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.DOMAIN_LOCKED_FOR_AUTO_PROVISION, Filter.createNOTFilter(Filter.createPresenceFilter("zimbraAutoProvLock")));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter domainsOnUCService(String usServiceId)
/*      */   {
/*  913 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.DOMAINS_ON_UCSERVICE, Filter.createANDFilter(new Filter[] { Filter.createEqualityFilter("zimbraUCServiceId", usServiceId), FILTER_ALL_DOMAINS }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter globalConfig()
/*      */   {
/*  926 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.GLOBAL_CONFIG, Filter.createEqualityFilter("cn", "config"));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter allIdentities()
/*      */   {
/*  937 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.ALL_IDENTITIES, FILTER_ALL_IDENTITIES);
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter identityByName(String name)
/*      */   {
/*  945 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.IDENTITY_BY_NAME, Filter.createANDFilter(new Filter[] { FILTER_ALL_IDENTITIES, Filter.createEqualityFilter("zimbraPrefIdentityName", name) }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter allMimeEntries()
/*      */   {
/*  958 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.ALL_MIME_ENTRIES, FILTER_ALL_MIME_ENTRIES);
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */   public ZLdapFilter mimeEntryByMimeType(String mimeType)
/*      */   {
/*  965 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.MIME_ENTRY_BY_MIME_TYPE, Filter.createEqualityFilter("zimbraMimeType", mimeType));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter allServers()
/*      */   {
/*  976 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.ALL_SERVERS, FILTER_ALL_SERVERS);
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */   public ZLdapFilter serverById(String id)
/*      */   {
/*  983 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.SERVER_BY_ID, Filter.createANDFilter(new Filter[] { Filter.createEqualityFilter("zimbraId", id), FILTER_ALL_SERVERS }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter serverByService(String service)
/*      */   {
/*  992 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.SERVER_BY_SERVICE, Filter.createANDFilter(new Filter[] { FILTER_ALL_SERVERS, Filter.createEqualityFilter("zimbraServiceEnabled", service) }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter serverByAlwaysOnCluster(String clusterId)
/*      */   {
/* 1001 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.SERVER_BY_ALWAYSONCLUSTER, Filter.createANDFilter(new Filter[] { FILTER_ALL_SERVERS, Filter.createEqualityFilter("zimbraAlwaysOnClusterId", clusterId) }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter serverByServiceAndAlwaysOnCluster(String service, String clusterId)
/*      */   {
/* 1010 */     if (clusterId == null)
/* 1011 */       return serverByService(service);
/* 1012 */     if (service == null) {
/* 1013 */       return serverByAlwaysOnCluster(clusterId);
/*      */     }
/* 1015 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.SERVERY_BY_SERVICE_AND_ALWAYSONCLUSTER, Filter.createANDFilter(new Filter[] { FILTER_ALL_SERVERS, Filter.createEqualityFilter("zimbraServiceEnabled", service), Filter.createEqualityFilter("zimbraAlwaysOnClusterId", clusterId) }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter allAlwaysOnClusters()
/*      */   {
/* 1029 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.ALL_ALWAYSONCLUSTERS, FILTER_ALL_ALWAYSONCLUSTERS);
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */   public ZLdapFilter alwaysOnClusterById(String id)
/*      */   {
/* 1036 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.ALWAYSONCLUSTER_BY_ID, Filter.createANDFilter(new Filter[] { Filter.createEqualityFilter("zimbraId", id), FILTER_ALL_ALWAYSONCLUSTERS }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter allUCServices()
/*      */   {
/* 1048 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.ALL_UC_SERVICES, FILTER_ALL_UC_SERVICES);
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */   public ZLdapFilter ucServiceById(String id)
/*      */   {
/* 1055 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.UC_SERVICE_BY_ID, Filter.createANDFilter(new Filter[] { Filter.createEqualityFilter("zimbraId", id), FILTER_ALL_UC_SERVICES }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter shareLocatorById(String id)
/*      */   {
/* 1068 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.SHARE_LOCATOR_BY_ID, Filter.createANDFilter(new Filter[] { Filter.createEqualityFilter("cn", id), FILTER_ALL_SHARE_LOCATORS }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter allSignatures()
/*      */   {
/* 1081 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.ALL_SIGNATURES, FILTER_ALL_SIGNATURES);
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */   public ZLdapFilter signatureById(String id)
/*      */   {
/* 1088 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.SIGNATURE_BY_ID, Filter.createANDFilter(new Filter[] { FILTER_ALL_SIGNATURES, Filter.createEqualityFilter("zimbraSignatureId", id) }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter allXMPPComponents()
/*      */   {
/* 1101 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.ALL_XMPP_COMPONENTS, FILTER_ALL_XMPP_COMPONENTS);
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */   public ZLdapFilter imComponentById(String id)
/*      */   {
/* 1108 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.XMPP_COMPONENT_BY_ZIMBRA_XMPP_COMPONENT_ID, Filter.createANDFilter(new Filter[] { FILTER_ALL_XMPP_COMPONENTS, Filter.createEqualityFilter("zimbraXMPPComponentId", id) }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter xmppComponentById(String id)
/*      */   {
/* 1117 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.XMPP_COMPONENT_BY_ID, Filter.createANDFilter(new Filter[] { Filter.createEqualityFilter("zimbraId", id), FILTER_ALL_XMPP_COMPONENTS }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter allZimlets()
/*      */   {
/* 1130 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.ALL_ZIMLETS, FILTER_ALL_ZIMLETS);
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter memberOf(String dnOfGroup)
/*      */   {
/* 1141 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.MEMBER_OF, Filter.createEqualityFilter("memberOf", dnOfGroup));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   private Filter velodromePrimaryEmailOnDomainFilter(String domainName)
/*      */   {
/* 1150 */     return Filter.createSubstringFilter("zimbraMailDeliveryAddress", null, null, "@" + domainName);
/*      */   }
/*      */   
/*      */   private Filter velodromeMailOrZimbraMailAliasOnDomainFilter(String domainName)
/*      */   {
/* 1155 */     return Filter.createORFilter(new Filter[] { Filter.createSubstringFilter("mail", null, null, "@" + domainName), Filter.createSubstringFilter("zimbraMailAlias", null, null, "@" + domainName) });
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */   public ZLdapFilter velodromeAllAccountsByDomain(String domainName)
/*      */   {
/* 1162 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.VELODROME_ALL_ACCOUNTS_BY_DOMAIN, Filter.createANDFilter(new Filter[] { FILTER_ALL_ACCOUNTS, velodromePrimaryEmailOnDomainFilter(domainName) }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter velodromeAllAccountsOnlyByDomain(String domainName)
/*      */   {
/* 1171 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.VELODROME_ALL_ACCOUNTS_ONLY_BY_DOMAIN, Filter.createANDFilter(new Filter[] { FILTER_ALL_ACCOUNTS_ONLY, velodromePrimaryEmailOnDomainFilter(domainName) }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter velodromeAllCalendarResourcesByDomain(String domainName)
/*      */   {
/* 1180 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.VELODROME_ALL_CALENDAR_RESOURCES_BY_DOMAIN, Filter.createANDFilter(new Filter[] { FILTER_ALL_CALENDAR_RESOURCES, velodromePrimaryEmailOnDomainFilter(domainName) }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter velodromeAllAccountsByDomainAndServer(String domainName, String serverServiceHostname)
/*      */   {
/* 1190 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.VELODROME_ALL_ACCOUNTS_BY_DOMAIN_AND_SERVER, Filter.createANDFilter(new Filter[] { FILTER_ALL_ACCOUNTS, homedOnServerFilter(serverServiceHostname), velodromePrimaryEmailOnDomainFilter(domainName) }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter velodromeAllAccountsOnlyByDomainAndServer(String domainName, String serverServiceHostname)
/*      */   {
/* 1201 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.VELODROME_ALL_ACCOUNTS_ONLY_BY_DOMAIN_AND_SERVER, Filter.createANDFilter(new Filter[] { FILTER_ALL_ACCOUNTS_ONLY, homedOnServerFilter(serverServiceHostname), velodromePrimaryEmailOnDomainFilter(domainName) }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter velodromeAllCalendarResourcesByDomainAndServer(String domainName, String serverServiceHostname)
/*      */   {
/* 1212 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.VELODROME_ALL_CALENDAR_RESOURCES_BY_DOMAIN_AND_SERVER, Filter.createANDFilter(new Filter[] { FILTER_ALL_CALENDAR_RESOURCES, homedOnServerFilter(serverServiceHostname), velodromePrimaryEmailOnDomainFilter(domainName) }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter velodromeAllDistributionListsByDomain(String domainName)
/*      */   {
/* 1228 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.VELODROME_ALL_DISTRIBUTION_LISTS_BY_DOMAIN, Filter.createANDFilter(new Filter[] { FILTER_ALL_DISTRIBUTION_LISTS, velodromeMailOrZimbraMailAliasOnDomainFilter(domainName) }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter velodromeAllGroupsByDomain(String domainName)
/*      */   {
/* 1242 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.VELODROME_ALL_GROUPS_BY_DOMAIN, Filter.createANDFilter(new Filter[] { FILTER_ALL_GROUPS, velodromeMailOrZimbraMailAliasOnDomainFilter(domainName) }));
/*      */   }
/*      */   
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   public ZLdapFilter dnSubtreeMatch(String... dns)
/*      */   {
/* 1251 */     List<Filter> filters = Lists.newArrayList();
/* 1252 */     for (String dn : dns) {
/* 1253 */       filters.add(Filter.createExtensibleMatchFilter("entryDN", "dnSubtreeMatch", false, dn));
/*      */     }
/*      */     
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/* 1260 */     return new UBIDLdapFilter(ZLdapFilterFactory.FilterId.DN_SUBTREE_MATCH, Filter.createORFilter(filters));
/*      */   }
/*      */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/ldap/unboundid/UBIDLdapFilterFactory.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */